<?php echo $this->render('link/header.phtml') ?>
//常用变量初始化
var menuDelUrl=baseUrl+"/link/server";
var menuEditUrl=baseUrl+"/link/server";
var gridTitle="链接列表";
var User = Ext.data.Record.create([
           {name: 'u_id', type: 'int'},
           {name: 'username', type: 'string'},
		   {name: 'realname', type: 'string'},
           {name: 'email', type: 'string'},
		   {name: 'input_date', type: 'string'},
           {name: 'role', type: 'string'},
		   {name:'pwd',type:'string'}
      ]);
      
var member_store_combo=new Ext.form.ComboBox({
										 fieldLabel:'role',
										 store:new Ext.data.JsonStore({
																	  autoLoad:true,
																	  url:baseUrl+'/admin/roledata',
																	  root:'results',
																	  fields:['role_name']
																	  }),										
        								displayField:'role_name',
        								valueField :'role_name',
										hiddenName:"role",
        								typeAhead:true,
        								mode:'local',
        								triggerAction:'all',
        								emptyText:'请选择...',
        								selectOnFocus:true
										 });    
var ds=new Ext.data.Store({
							  proxy:new Ext.data.HttpProxy({
									url:baseUrl+'/admin/userdata/'
									}),
							  reader:new Ext.data.JsonReader({
									root:'results',
									totalProperty:'total',
									id:'u_id'
									},User)
	});		 
//定义列模型
var cm=new Ext.grid.ColumnModel([	
							new Ext.grid.RowNumberer(),									 
							{header:'登录名',dataIndex:'username',width:200,editor:new Ext.form.TextField({allowBlank:false,vtype:'alphanum'})},
							{header:'实名',dataIndex:'realname',width:150,editor:new Ext.form.TextField({allowBlank:false})},
							{header:'邮箱',dataIndex:'email',width:150,editor:new Ext.form.TextField({allowBlank:false,vtype:'email'})},
							{header:'加入日期',dataIndex:'input_date',width:250,editor:new Ext.form.HtmlEditor({width:500})},
							{header:'权限组',dataIndex:'role',width:250,editor:member_store_combo}
	]);
cm.defaultSortable = true; 



//定义工具栏								 
var tb=new Ext.Toolbar({
							items:[

                                         {
                                            id:'menuDel'+ExtId,
											text:'删除',
											iconCls:'icn-delete',
											handler:menuDel
											},{
											id:'menu_save'+ExtId,
											text:'保存',	
											iconCls:'icn-edit',
											disabled:true,
											handler:menuSave
											},{
											xtype:'tbfill'
											},{
                                            id:'menu_quickadd'+ExtId,
											text:'快速添加',
											iconCls:'icn-add',
											handler:menuAddQuick
										}
											 
								 ]
	});			
   
function  menuAdd(){

}		
function menuAddQuick(){
	
	var n = grid.getStore().getCount();// 获得总行数
                var p = new User({
                    u_id:"",
                    username: '',
					realname:'ben',
                    email: 'Ben@onechoose.com',
					input_date:time,
					role:'',
					pwd:'123456'

                });
                grid.stopEditing();// 停止编辑
                ds.insert(n, p);// 插入到最后一行
                grid.startEditing(n, 1);// 开始编辑1单元格
				Ext.getCmp('menu_save'+ExtId).setDisabled(false);
	}			      
<?php echo $this->render('link/foot.phtml') ?>
